package com.itheima.commons.utils;

import cn.hutool.core.util.StrUtil;

import java.text.DecimalFormat;

public class MakePercentage {
    /**
     *传入两个数字，除法求百分号
     * @param a 被除数
     * @param b 除数
     * @return
     */
    public static String makePercentage(int a,int b){
        double baia = a * 1.0;
        double baib = b * 1.0;
        double fen = baia / baib;
        DecimalFormat df1 = new DecimalFormat("##.00%");
        String format = df1.format(fen);
        if(fen!=fen){
            format = "0%";
        }
        return format;
    }
}
